We are extracting Copernicus Marine data from across National Marine Sanctuaries, borrowing polygons from the noaa-onms/climate-dashboard (see Github code).
Code
if (!file.exists(sanctuaries_geo)){# source: https://github.com/noaa-onms/climate-dashboard/blob/main/data/sanctuaries.rds sanctuaries_rds <-here("../climate-dashboard/data/sanctuaries.rds")readRDS(sanctuaries_rds) |>filter(nms !="TBNMS") |># exclude Great Lakeswrite_sf(sanctuaries_geo, delete_dsn = T)}sanctuaries <-read_sf(sanctuaries_geo)sanctuaries |>st_drop_geometry() |>datatable()
File data/copernicus/FKNMS/cmems_mod_glo_phy_my_0.083deg_P1M-m_multi-vars_83.25W-80.00W_24.25N-25.75N_0.49m_1993-01-01-2021-06-01.nc (NC_FORMAT_NETCDF4):
4 variables (excluding dimension variables):
short thetao[longitude,latitude,depth,time] (Contiguous storage)
[1] ">>>> WARNING <<< attribute valid_max is an 8-byte value, but R"
[1] "does not support this data type. I am returning a double precision"
[1] "floating point, but you must be aware that this could lose precision!"
[1] ">>>> WARNING <<< attribute valid_min is an 8-byte value, but R"
[1] "does not support this data type. I am returning a double precision"
[1] "floating point, but you must be aware that this could lose precision!"
_FillValue: -32767
cell_methods: area: mean
long_name: Temperature
standard_name: sea_water_potential_temperature
unit_long: Degrees Celsius
units: degrees_C
valid_max: 22600
valid_min: -32767
add_offset: 21
scale_factor: 0.000732444226741791
short bottomT[longitude,latitude,time] (Contiguous storage)
[1] ">>>> WARNING <<< attribute valid_max is an 8-byte value, but R"
[1] "does not support this data type. I am returning a double precision"
[1] "floating point, but you must be aware that this could lose precision!"
[1] ">>>> WARNING <<< attribute valid_min is an 8-byte value, but R"
[1] "does not support this data type. I am returning a double precision"
[1] "floating point, but you must be aware that this could lose precision!"
_FillValue: -32767
cell_methods: area: mean
long_name: Sea floor potential temperature
standard_name: sea_water_potential_temperature_at_sea_floor
unit_long: Degrees Celsius
units: degrees_C
valid_max: 22600
valid_min: -32767
add_offset: 21
scale_factor: 0.000732444226741791
short so[longitude,latitude,depth,time] (Contiguous storage)
[1] ">>>> WARNING <<< attribute valid_max is an 8-byte value, but R"
[1] "does not support this data type. I am returning a double precision"
[1] "floating point, but you must be aware that this could lose precision!"
[1] ">>>> WARNING <<< attribute valid_min is an 8-byte value, but R"
[1] "does not support this data type. I am returning a double precision"
[1] "floating point, but you must be aware that this could lose precision!"
_FillValue: -32767
cell_methods: area: mean
long_name: Salinity
standard_name: sea_water_salinity
unit_long: Practical Salinity Unit
units: 1e-3
valid_max: 31700
valid_min: 1
add_offset: -0.00152592547237873
scale_factor: 0.00152592547237873
short mlotst[longitude,latitude,time] (Contiguous storage)
[1] ">>>> WARNING <<< attribute valid_max is an 8-byte value, but R"
[1] "does not support this data type. I am returning a double precision"
[1] "floating point, but you must be aware that this could lose precision!"
[1] ">>>> WARNING <<< attribute valid_min is an 8-byte value, but R"
[1] "does not support this data type. I am returning a double precision"
[1] "floating point, but you must be aware that this could lose precision!"
_FillValue: -32767
cell_methods: area: mean
long_name: Density ocean mixed layer thickness
standard_name: ocean_mixed_layer_thickness_defined_by_sigma_theta
unit_long: Meters
units: m
valid_max: 23400
valid_min: 1
add_offset: -0.152592554688454
scale_factor: 0.152592554688454
4 dimensions:
depth Size:1
axis: Z
long_name: Depth
positive: down
standard_name: depth
unit_long: Meters
units: m
valid_max: 0.494024991989136
valid_min: 0.494024991989136
latitude Size:19
axis: Y
long_name: Latitude
standard_name: latitude
step: 0.0833358764648438
unit_long: Degrees North
units: degrees_north
valid_max: 25.75
valid_min: 24.25
longitude Size:40
axis: X
long_name: Longitude
standard_name: longitude
step: 0.0833282470703125
unit_long: Degrees East
units: degrees_east
valid_max: -80
valid_min: -83.25
time Size:342
[1] ">>>> WARNING <<< attribute valid_min is an 8-byte value, but R"
[1] "does not support this data type. I am returning a double precision"
[1] "floating point, but you must be aware that this could lose precision!"
[1] ">>>> WARNING <<< attribute valid_max is an 8-byte value, but R"
[1] "does not support this data type. I am returning a double precision"
[1] "floating point, but you must be aware that this could lose precision!"
valid_min: 376944
valid_max: 626016
units: hours since 1950-01-01
calendar: gregorian
15 global attributes:
Conventions: CF-1.6
area: GLOBAL
contact: servicedesk.cmems@mercator-ocean.eu
credit: E.U. Copernicus Marine Service Information (CMEMS)
dataset: global-reanalysis-001-030-monthly
institution: Mercator Ocean
licence: http://marine.copernicus.eu/services-portfolio/service-commitments-and-licence/
producer: CMEMS - Global Monitoring and Forecasting Centre
product: GLOBAL_REANALYSIS_001_030
product_user_manual: http://marine.copernicus.eu/documents/PUM/CMEMS-GLO-PUM-001-030.pdf
quality_information_document: http://marine.copernicus.eu/documents/QUID/CMEMS-GLO-QUID-001-030.pdf
references: http://marine.copernicus.eu
source: MERCATOR GLORYS12V1
title: Monthly mean fields for product GLOBAL_REANALYSIS_PHY_001_030
copernicusmarine_version: 1.3.2
Using terra::rast() to read the netcdf file, show first layer: